/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    overflow: hidden;
}

/* Container with responsive height - 450px for iframe, 90vh for standalone */
.container {
    width: 100%;
    height: 450px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 10px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Detect if running in standalone mode */
@media (min-height: 500px) {
    .container {
        height: 90vh;
    }
}

/* Game header - compact design */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(103, 126, 234, 0.1);
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: help;
    transition: background-color 0.3s ease;
}

.game-header:hover {
    background: rgba(103, 126, 234, 0.2);
}

.score-display {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
    font-weight: 600;
}

.level-display {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9em;
    font-weight: 600;
}

.progress-bar {
    width: 80px;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    width: 0%;
    transition: width 0.3s ease;
}

/* Main game area */
.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
}

/* Word display area */
.word-display {
    text-align: center;
    margin-bottom: 15px;
}

.current-word {
    font-size: 2.5em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.current-word.correct {
    color: #4CAF50;
    transform: scale(1.1);
}

.current-word.incorrect {
    color: #f44336;
    animation: shake 0.5s ease-in-out;
}

.word-meaning {
    font-size: 0.9em;
    color: #666;
    font-style: italic;
    max-height: 40px;
    overflow: hidden;
    cursor: help;
    padding: 5px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.word-meaning:hover {
    background: rgba(103, 126, 234, 0.1);
}

/* Input area */
.input-area {
    margin-bottom: 15px;
}

#typeInput {
    width: 100%;
    padding: 12px 16px;
    font-size: 1.2em;
    border: 2px solid #ddd;
    border-radius: 25px;
    outline: none;
    text-align: center;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

#typeInput:focus {
    border-color: #667eea;
    box-shadow: 0 0 15px rgba(103, 126, 234, 0.3);
    transform: scale(1.02);
}

.input-feedback {
    text-align: center;
    margin-top: 5px;
    font-size: 0.9em;
    min-height: 20px;
    font-weight: 600;
}

.input-feedback.correct {
    color: #4CAF50;
}

.input-feedback.incorrect {
    color: #f44336;
}

/* Controls */
.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 10px;
}

.control-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
    height: auto;
    white-space: nowrap;
}

.start-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.start-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.pause-btn {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
}

.pause-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.4);
}

.reset-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.reset-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.4);
}

.control-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Game info */
.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
    color: #666;
}

.timer-display {
    font-weight: 600;
    color: #667eea;
}

.next-words {
    font-size: 0.8em;
    opacity: 0.8;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 90%;
    width: 300px;
}

.modal-content h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.results p {
    margin: 8px 0;
    font-size: 1em;
}

.modal-controls {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.8em;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    max-width: 200px;
    text-align: center;
}

/* Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .container {
        padding: 8px;
    }
    
    .current-word {
        font-size: 2em;
        min-height: 50px;
    }
    
    .score-display {
        gap: 10px;
        font-size: 0.8em;
    }
    
    .controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .control-btn {
        min-width: 70px;
        padding: 8px 16px;
        font-size: 0.8em;
    }
    
    .game-info {
        font-size: 0.8em;
    }
}

/* Touch support */
@media (hover: none) and (pointer: coarse) {
    .control-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    #typeInput {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}